package com.mycompany.myapp.repository;

import com.mycompany.myapp.domain.Order;
import com.mycompany.myapp.service.dto.OrderDTO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * Spring Data  repository for the Order entity.
 */
@SuppressWarnings("unused")
@Repository
public interface OrderRepository extends JpaRepository<Order, Long> {

    List<Order> findBySuserId(Long userId);

    List<Order> findBySuserIdAndStatus(Long userId,String status);

    @Query("select o from Order o where o.id like  concat('%',?1,'%')")
    Page<Order> findByParams(Long query, Pageable pageable);

    List<Order> findAll(Specification<Order> specification);
}
